# 编写一个程序，接受用户的输入并保存为新的文件


def write_func():
    file_name = input("请输入文件名：")
    file = open(file_name, "w")
    print("请输入内容【单独输入':w'保存并退出】：")
    while True:
        line = input()
        if line == ":w":
            break
        else:
            file.write("%s\n" % line)
    file.close()


if __name__ == "__main__":
    write_func()